package com.learning.rpc.config;

import java.util.ArrayList;
import java.util.List;

/**
 * ClassName: ServiceConfig
 * Description: 服务配置
 * Date: 2022/5/10 23:02 【需求编号】
 *
 * @author Sam Sho
 * @version V1.0.0
 */
public class ServiceConfig {

    /**
     * 多注册中心
     */
    private List<RegistryConfig> registryConfigs;

    /**
     * 多协议
     */
    private List<ProtocolConfig> protocolConfigs;
    /**
     * 服务接口
     */
    private Class<?> service;
    /**
     * 实现类
     */
    private Object reference;
    /**
     * 版本
     */
    private String version;

    public List<RegistryConfig> getRegistryConfigs() {
        return registryConfigs;
    }

    public void setRegistryConfigs(List<RegistryConfig> registryConfigs) {
        this.registryConfigs = registryConfigs;
    }

    public synchronized void addRegistryConfig(RegistryConfig registryConfig) {
        if (registryConfigs == null) {
            registryConfigs = new ArrayList<RegistryConfig>();
        }
        this.registryConfigs.add(registryConfig);
    }

    public List<ProtocolConfig> getProtocolConfigs() {
        return protocolConfigs;
    }

    public void setProtocolConfigs(List<ProtocolConfig> protocolConfigs) {
        this.protocolConfigs = protocolConfigs;
    }

    public synchronized void addProtocolConfig(ProtocolConfig protocolConfig) {
        if (protocolConfigs == null) {
            protocolConfigs = new ArrayList<ProtocolConfig>();
        }
        this.protocolConfigs.add(protocolConfig);
    }

    public Class getService() {
        return service;
    }

    public void setService(Class service) {
        this.service = service;
    }

    public Object getReference() {
        return reference;
    }

    public void setReference(Object reference) {
        this.reference = reference;
    }

    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }
}
